Document Storage Providers

About Document Storage Providers

Document storage providers, typically packaged as an AddIn, enable WebEdit to view, edit, merge, and save text documents from any source, such an e-mail system, a database, a code repository, embedded resources, or additional network protocols. The application itself uses the same mechanism for local, FTP, HTTP, embedded resource documents.

Walkthrough

A Document storage provider consists of at least the following elements:

Storage Provider Class

base class:    Gregor.WebEdit.Documents.CStorageProviderBase
instantiation: at startup
registration:  append to storage providers collection,
               through WebEditApp.DocumentManager.StorageProviders

The registered storage provider object is charged with creating both history entries and, based on a given history entry, a storage object. The storage provider creates history entries based on string specifications (which result from user commands, or when the history is being deserialized), or based on a user request to browse for a document location during Open, OpenTemplate, InsertFile, or SaveAs operations (if document location browsing [as with a file dialog] and the given operation are supported). The storage provider may support additional operations, such as opening a document's container (folder etc.) in (for example) a tool window, if appropriate.

Storage Class

base classes:  Gregor.WebEdit.Documents.CWebEditStorage,
               or Gregor.WebEdit.Documents.CWebEditRemoteStorage
instantiation: CreateStorage() method of the storage provider

The storage class is responsible for reading from (and, if supported, writing to) the data source. By holding a history entry, it indirectly identifies the document in a given document controller.

History Entry Class

base classes:  Gregor.WebEdit.Documents.CWebEditHistoryEntry,
               or Gregor.WebEdit.Documents.CWebEditRemoteHistoryEntry
instantiation: CreateHistoryEntry() methods of the storage provider

This history entry must provide a value through the FullPath property that completely and uniquely identifies a given document. The storage provider must be able to create a valid history entry from a given string, which then becomes the value of the FullPath property. If command manager and custom protocol are used (strongly recommended), this value can be used as a command for opening the document by recreating that history entry.

The history entry class controls the icons used for symbolizing documents, some aspects of the representation in the History window, whether a particular document (or all) can be saved, whether a document's container can be opened, etc.

Command Manager Class

base class:    Gregor.WebEdit.Commands.CCommandManagerBase
instantiation: at startup
registration:  append to command managers collection,
               through WebEditApp.CommandManagers

Note: this is not strictly necessary, but strongly recommended. This must be used with a custom protocol. A command manager must be capable of interpreting the FullPath property of a (storage-provider-created) history entry, in order to call the storage provider's CreateHistoryEntry(String) method (round-trip of command strings and history entries).

By integrating with the command model, a document storage provider enables the user to open its documents with textual commands, send these document to other agents on the system that recognize the protocol, create shortcuts in the Windows Favorites, pass arguments to the command line in order to open documents at startup, and more.

Protocol

syntax:        string of letters, minimum length is two
registration:  append to protocol collection at start up,
               through WebEditApp.Protocols

Note: this is not strictly necessary, but strongly recommended. This must be used with a custom command manager.

Addtional extensions

Well-behaved document storage providers add the following to the setup:


See Also: Extension Points | WebEdit.NET API | AddIns